jsun.run(function(){
///////////////////////////////////////

    function DeselItem() {
        jsun.ajax.send_request({ asyn: false,
            param: "u=Index/DeselItem&item_id="
                + this.getAttribute("data-id") });

        jsun.json.load(function(p) {
            var div = jsun('#SelItemsTableDiv');
            div.innerHTML = "";
            div.appendChild(jsun.dom.from_json(p));
        }, 'u=Reader&m=Reader\\Order/GetSelItemsTable');

        return true;
    }

    function ClearItems() {
        jsun.ajax.send_request({param: "u=Index/ClearItems", asyn: false});

        var row = this.parentNode.parentNode.nextSibling;

        while (row) {
            var rows = row.nextSibling;
            row.parentNode.removeChild(row);
            row = rows;
        }
    }

    var list = jsun("#SelItemsTable").firstChild.childNodes;
    jsun.dom.mix(list[0].lastChild.firstChild).event({onclick: ClearItems});

    for (var i = 1; i < list.length; ++i) {
        var item = list[i].lastChild.firstChild;
        jsun.dom.mix(item).event({onclick: DeselItem});
    }
///////////////////////////////////////////
});




